// pages/home/home.js
const app= getApp();
Page({
  onShareAppMessage() {
    return {
      title: 'swiper',
      path: 'page/component/pages/swiper/swiper'
    }
  },
  data: {
    background: [],
    list:[],
    indicatorDots: true,
    vertical: true,
    autoplay: true,
    interval: 5000,
    duration: 1000,
    circular:true,
    active: 1
  },
onLoad(){
  this.getL()
  this.gethome()
},
gethome(type=1){
  app.get('film/list?type='+type).then(res => {
    console.log(res)
    this.setData({
      list:res.data
    },()=>{
      wx.hideLoading()
    })
  })
},
  getL(){
    app.get('film/banners').then(res => {
      console.log(res)
      this.setData({
        background:res.data
      },()=>{
        wx.hideLoading()
      })
    })
  },

  changeIndicatorDots() {
    this.setData({
      indicatorDots: !this.data.indicatorDots
    })
  },

  changeAutoplay() {
    this.setData({
      autoplay: !this.data.autoplay
    })
  },

  intervalChange(e) {
    this.setData({
      interval: e.detail.value
    })
  },

  durationChange(e) {
    this.setData({
      duration: e.detail.value
    })
  },
  // tab切换
  onChange(event) {
    let type = event.detail.name;
    this.gethome(type);
  },
})